#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <sqldatabase.h>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QtSql/QSqlQuery>
#include <QPixmap>
#include <InternetClient.h>
#include <sqlite.h>
#include <QHostAddress>
#include <database.h>
#include "login.h"
#include "mychart.h"
#include <QSerialPortInfo>
#include <QSerialPort>
#include <QByteArray>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class InternetServer;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();
    void receiveParameter(QString pixmap_inform);
    void on_checkBox_stateChanged(int arg1);
    void on_checkBox_2_stateChanged(int arg1);
    void on_pushButton_2_clicked();

    void on_lineEdit_3_textChanged(const QString &arg1);

    void on_lineEdit_6_textChanged(const QString &arg1);

    void on_lineEdit_5_textChanged(const QString &arg1);

    void on_lineEdit_4_textChanged(const QString &arg1);

    void slotReadData();

public:
    Ui::MainWindow *ui;
    void setArg(float temperature, float MFS, float dust_density, float humidity, QDateTime currentDateTime);
    void timerEvent(QTimerEvent *event);
    void slotLoadSerialPort();
    void slotCloseSerialPort();
    void slotOpenSerialPort();

    void slotSend();
private:
    QPixmap pixmap;
    internetClient c;
    InternetServer * s;
    database d;
    database b;
    const QString hostName;
    quint16 port;
    bool on_off;
    int mode;
    login * l = new login;
    sqlite * q = new sqlite;
    int arg1 = 0;
    mychart chart;
    int i;
    QSerialPort *m_serialPort;
};
#endif // MAINWINDOW_H
